import toolUni from "./ToolUni";
import tool from "./Tool";
import toolVuex from "./vuex/ToolVuex.js";
import toolCloud from "./cloud/tool-cloud.js";
import toolApis from "./http/ToolApis.js";
import toolImg from "./tool-img.js";

import vueDirective from "./vue/directive/index.js";
import vueMixin from "./vue/mixin/index.js";

let toolIndex = {
	install(app) {
		let Tool = {
			$tool: tool,
			$toolUni: toolUni,
			$toolVuex: toolVuex,
			$toolApis: toolApis,
			$toolImg: toolImg,
			$request: (action, params) => toolCloud.init().send(action, params),
			log: param => toolVuex.commit("log/log", param)
		}
		
		Object.assign(app.config.globalProperties, Tool);
		Object.assign(window, Tool);
		
		toolIndex.initPluge(app);
	},
	initPluge(app) {
		// 初始化vue自定义指令
		app.use(vueDirective);
		// 初始化 mixins
		app.use(vueMixin);
	}
}

export default toolIndex;
